﻿using System;
using System.Collections.Generic;
using System.Text;

namespace InternetSpiderLib
{
    /// <summary>
    /// 场景的实际对象
    /// </summary>
    public class SceneItem
    {
        /// <summary>
        /// 场景排序依据
        /// </summary>
        public int SceneOrder { get; set; }

        /// <summary>
        /// 场景过滤器
        /// </summary>
        public ISceneFilter Filter { get; set; }

        /// <summary>
        /// 场景动作
        /// </summary>
        public ISceneAction SceneAction { get; set; }

        /// <summary>
        /// 运行这个场景
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool Run(DataBox data)
        {
            if (!(Filter?.Filter(data) ?? true))
                return false;

            SceneAction?.Run(data);
            return true;
        }
    }
}
